package com.leyou.item.mapper;

import com.leyou.item.pojo.Brand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.IdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand>,IdListMapper<Brand,Long>{
    @Insert("INSERT INTO tb_category_brand (category_id, brand_id) VALUES (#{cid},#{bid})")
    int insertCategoryBrand(@Param("cid") Long cid, @Param("bid") Long id);

    @Select("SELECT b.* FROM\n" +
            "tb_brand b INNER JOIN tb_category_brand cb ON b.id=cb.brand_id \n" +
            "WHERE cb.category_id = '76';")
    List<Brand> selectBrandByCid(@Param("cid") Long cid);
}
